<?php
namespace Home\Controller;
use Think\Controller;
class FenleiController extends BaseController {
    public function index(){
        
        $id = I('get.id');
        $m =M('pathclass');
        $fenleiInfo = $m ->where("id ={$id}")->find();
        $this ->assign("path",$fenleiInfo);
        
        //$count      = $article->where("tid = $id AND status = 1")->count();
        //$Page       = new \Think\Page($count,10);
        //$show       = $Page->show();//
    /*    $articleList = $article->where("tid = $id AND status = 1")->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
        $this->assign("articleList",$articleList);
      */ 
        $article = D("text");
        $Model = new \Think\Model();
        $count = $article->where("tid = $id AND status = 1")->count();
        $page = new \Think\Page($count,4);
        $Model = new \Think\Model();
        $sql = "select u.nickname uname,t.id tid,t.picname tpname,t.name tname,t.content tcontent,t.createtime ctime,t.comment tcomment,t.view tview,t.biaoqian tbiaoqian,t.pingfen tpingfen from pro_user as u, pro_pathclass as p ,pro_text as t where t.tid = $id AND u.id=t.bid AND t.tid = p.id AND t.status = 1 order by tid desc limit $page->firstRow,$page->listRows";
        $data = $Model->query($sql);
        //dump($sql);
        $show=$page->show();
        $this->assign("page",$show);
        $this->assign('data',$data);



        //$this->assign('page',$show);
         
        $this->display();
        /*$id = I('get.id');
        $m =M('fenlei');
        $fenleiInfo = $m ->where("id ={$id}")->find();
        $this ->assign("fenleiInfo",$fenleiInfo);
        $article = D("article");
        $count      = $article->where("fid = '%s' AND status = 0",$id)->count();
        $Page       = new \Think\Page($count,10);
        $show       = $Page->show();//
        $articleList = $article->where("fid = '%s' AND status = 0",$id)->relation(true)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
        $this->assign("articleList",$articleList);
        $this->assign('page',$show);
        $this->display();*/
    }
}
